/*!
 * 
 * 选择班组
 * 
 * 
 */
Ext.onReady(function(){
	
    var tree = new Ext.tree.TreePanel({
                id:"select_teams_tree",   
                root : new Ext.tree.AsyncTreeNode({   
            		id : "0", 
            		draggable:false, 
            		singleClickExpand:true, 
            		text : "选择班组",
            		qtip:'100'
					}),   
					loader:new Ext.tree.TreeLoader({
            		url : 'menu!getMenu.do?parentID=',
            		listeners:{"beforeload":function(loader, node){ 
    						loader.url ='organ!getOrgan.do?parentID=' + node.id ;
            		}}
       		 	}),
       		 	buttons: [{
                 text: '确定',
                 handler: function(){
                     var msg = '', selNodes = tree.getChecked();
                     Ext.each(selNodes, function(node){
                         if(msg.length > 0){
                             msg += ', ';
                         }
                         msg += node.text;
                     });
                     Ext.Msg.show({
                         title: '选择的班组', 
                         msg: msg.length > 0 ? msg : 'None',
                         icon: Ext.Msg.INFO,
                         minWidth: 200,
                         buttons: Ext.Msg.OK
                     });
                 }
                }],
                rootVisible:false,
		        useArrows:true,
		        autoScroll:true,
		        animate:true,
		        enableDD:true,	
		        frame: true,
		        containerScroll: true
		        
            });
    
    tree.getRootNode().expand(true);
    
});